package com.bat.spring.factorybean;

import com.bat.spring.normalbean.AppleService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author: liusen
 * @date: 2022-04-13
 * @desc:
 **/
@Configuration
@ComponentScan("com.bat.spring.factorybean")
public class FactoryBeanAppConfig {

	public static void main(String[] args) {
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(FactoryBeanAppConfig.class);

		System.out.println(context.getBean("myFactoryBean"));
		OrangeService bean = context.getBean(OrangeService.class);
		System.out.println(bean.myFactoryBean);
		System.out.println(bean.orange);
		System.out.println();

		//System.out.println(context.getBean("&myFactoryBean"));
	}

}
